/* ButtonCartRefreshHandler.js <?php
#   --------------------------------------------------------------
#   ButtonCartRefreshHandler.js 2011-10-19 gambio
#   Gambio GmbH
#   http://www.gambio.de
#   Copyright (c) 2011 Gambio GmbH
#   Released under the GNU General Public License (Version 2)
#   [http://www.gnu.org/licenses/gpl-2.0.html]
#   --------------------------------------------------------------
?>*/
/*<?php
if($GLOBALS['coo_debugger']->is_enabled('uncompressed_js') == false)
{
?>*/
function ButtonCartRefreshHandler(){$(document).ready(function(){if(fb)console.log('ButtonCartRefreshHandler ready');coo_button_cart_refresh_handler.init_binds()});this.init_binds=function(){if(fb)console.log('ButtonCartRefreshHandler init_binds');$('.button_cart_refresh').die('click');$('.button_cart_refresh').live('click',function(event){if(fb)console.log('.button_cart_refresh click');if($(this).hasClass('wishlist_button')){if(fb)console.log('-- wishlist_button found');update_wishlist();return false}var coo_quantity_checker=new GMOrderQuantityChecker(),t_result=coo_quantity_checker.check_cart();if(t_result==true){$('#cart_quantity').submit()}return false});$('#cart_quantity').submit(function(){var coo_quantity_checker=new GMOrderQuantityChecker(),t_result=coo_quantity_checker.check_cart();if(t_result!=true){return false}})};}
/*<?php
}
else
{
?>*/
function ButtonCartRefreshHandler()
{
	$(document).ready(
		function()
		{
			if(fb)console.log('ButtonCartRefreshHandler ready');

			coo_button_cart_refresh_handler.init_binds();
		}
	);


	this.init_binds = function()
	{
		if(fb)console.log('ButtonCartRefreshHandler init_binds');


		$('.button_cart_refresh').die('click');
		$('.button_cart_refresh').live('click', function(event)
		{
			if(fb)console.log('.button_cart_refresh click');

			if($(this).hasClass('wishlist_button'))
			{
				if(fb)console.log('-- wishlist_button found');
				update_wishlist();
				return false;
			}

            var coo_quantity_checker = new GMOrderQuantityChecker();
            var t_result = coo_quantity_checker.check_cart();

            if(t_result == true) {
				$('#cart_quantity').submit();
            }

			return false;
		});

		$('#cart_quantity').submit(function()
		{
			var coo_quantity_checker = new GMOrderQuantityChecker();
            var t_result = coo_quantity_checker.check_cart();

			if(t_result != true)
			{
				return false;
            }
		});
	}
}
/*<?php
}
?>*/
